<template>
	<view class="bgw">
		<view class="navBar bgw  p30">
			<view  @tap="tab('all')" :class="{ act: type == 'all' }">全部</view>
			<view @tap="tab(true)" :class="{ act: type == true }">好评</view>
			<view @tap="tab(false)" :class="{ act: type == false }">中差评</view> 
		</view>
		<ul>
			<li v-for="(v,i) in commentList" :key="i"  class="comment  p30">
				<view class="commentUser ">
					<image class="ffl" :src="v.memberInfo.avatarImg" ></image>
					<view class="txt ">
						<p class="p1 ">{{v.memberInfo.name}}</p>
						<p class="p2 ">
							评分
							<image v-for="(v,i) in v.score" class="star" src="../../static/image/star.png" mode=""></image> 
						</p>
						<p class="p3 ">{{v.content}}</p>
						<view  class="imageList">
							<image v-for="(j,k) in v.images" :src="j" :key="k" mode="aspectFit"></image> 
						</view>
						<view v-if="v.reply"  class="bottom">
							<i></i>
							<p >商家回复: {{v.reply}}</p>
						</view>
					</view>
				</view>
			</li> 
		</ul>
		<p v-show="commentList == '' " class="noneComment">
			很抱歉，当前没有评价
		</p>
	</view>
</template>
<script>
	import {productCommentList} from '@/api/api.js'
	export default{
		data(){
			return{
				id:0,
				type:'all',
				commentList:[]
			}
		},
		created() {
			let  data = uni.getStorageSync('shopdetailsGoodsNav') 
			this.id = data.store.id 
			this.init()
		},
		methods:{
			async init(){
				let parameret ={
					storeId:this.id
				}
				if(this.type == true){
					parameret.isFavourable = true
				}
				if(this.type == false){
					parameret.isFavourable = false
				}
				let data = await productCommentList(parameret)
				this.commentList = [...this.commentList,...data.data.content]
			},
			inits(){
				this.commentList = []
				this.init()
			},
			tab(type){
				this.type = type
				 this.commentList = []
				 this.init()
			}
		}
	}
</script>
<style lang="less" scoped> 
.card{
	width: 40rpx;
	height: 42rpx;
}
.navBar{
	display: flex;
	// padding-top: 30rpx;
	padding-bottom: 30rpx; 
	background: white;
	z-index: 99999;
	view{
		padding: 0 34rpx;
		height:56rpx;
		line-height: 56rpx;
		text-align: center; 
		border-radius:8rpx;
		margin-right: 24rpx;
		background: #F8F8F8;
	}
	.act{
		border: 1px solid #1BBF80;
		color:#1BBF80;
		background:#E8F8F2;
	}
}
.listBgs{
	background: #F8F8F8;
	width: 100%;
	height: 20rpx;
}
.comment{
	border-bottom: 1rpx solid #EEEEEE;
	padding-top: 30rpx;
	padding-bottom: 40rpx;
	.title{
		height: 90rpx;
		// line-height: 90rpx;
		display: flex;
		overflow: hidden;
		view{
			flex: 1;
			text-align: right;
		}
		.go{
			width: 30rpx;
			height: 30rpx;
		}
	}
	.commentUser{
		display:flex;
		// padding-top: 30rpx;
		.ffl{
			margin-top: 10rpx;
			width: 72rpx;
			height:72rpx;
			// flex: 1;
			border-radius: 50%; 
		}
		.txt{
			margin-left: 30rpx;
			width: 600rpx;
			padding-top: 6rpx;
			color: #666666;
		}
		.p1{
			margin-bottom: 4rpx; 
			font-size: 28rpx; 
			color: #282828;
		}
		.p2{
			image{
				width: 24rpx;
				height: 24rpx;
				margin-left: 6rpx;
			}
		}
		.p3{
			margin-top: 20rpx;
			color: #282828;
		}
	}
	.imageList{
		margin-top: 18rpx;
		image{
			width: 152rpx;
			height: 152rpx;
			margin-right: 20rpx;
		}
	}
	.bottom{
		background: #F5F5F5;
		position: relative;
		line-height: 40rpx;
		border-radius: 10rpx;
		padding: 20rpx;
		margin-top: 30rpx;
		i{
			position: absolute;
			left: 120rpx;
			top: -15rpx;
			display: inline-block;
			width: 30rpx;
			height: 30rpx;
			background:#F5F5F5;
			transform: rotate(45deg);
		}
	}
}
.noneComment{
	padding: 30rpx;
	margin-top: 20rpx;
}
	// @import './index.less';
</style>